package com.zzyl.nursing.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Arrays;

@Data
@ApiModel(description = "护理任务值对象")
public class NursingTaskVo {

    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "主键")
    private Long id;

    @ApiModelProperty(value = "护理人员ID列表（逗号分隔）")
    private String nursingId;

    @ApiModelProperty(value = "项目ID")
    private Long projectId;

    @ApiModelProperty(value = "项目名称")
    private String projectName;

    @ApiModelProperty(value = "老人ID")
    private Long elderId;

    @ApiModelProperty(value = "老人姓名")
    private String elderName;

    @ApiModelProperty(value = "床位号")
    private String bedNumber;

    @ApiModelProperty(value = "预计服务时间")
    private LocalDateTime estimatedServerTime;

    @ApiModelProperty(value = "状态 1：已完成，0：未完成")
    private Integer status;

    // 辅助字段，用于存储从数据库查询得到的逗号分隔的护理人员名字
    private String nursingNames;

    @ApiModelProperty(value = "护理人员姓名列表")
    private List<String> nursingName;

    // Getter for nursingName to convert the comma-separated string to a list
    public List<String> getNursingName() {
        if (this.nursingNames == null || this.nursingNames.isEmpty()) {
            return null;
        }
        return Arrays.asList(this.nursingNames.split(","));
    }

    // Setter for nursingNames to allow setting from the database result
    public void setNursingNames(String nursingNames) {
        this.nursingNames = nursingNames;
    }
}